//
//  UIButton+WQExtension.m
//  sanwuWeiboOC
//
//  Created by 王先强 on 15/12/8.
//  Copyright © 2015年 王先强. All rights reserved.
//

#import "UIButton+WQExtension.h"

@implementation UIButton (WQExtension)

+(instancetype)buttonWithBackgroundImage:(NSString *)imageName title:(NSString *)title color:(UIColor *)color{
    
    
    UIButton *btn = [[UIButton alloc] init];
    [btn setTitle:title forState:UIControlStateNormal];
    [btn setBackgroundImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
    [btn setTitleColor:color forState:UIControlStateNormal];
    
    
    return btn;
}

+(instancetype)buttonWithImageName:(NSString *)imageName backgroundImageName:(NSString *)backImageName
{
    
    UIButton *composeBtn = [[UIButton alloc] init];
    [composeBtn setImage:[UIImage imageNamed:[imageName stringByAppendingString:@"_highlighted"]] forState:UIControlStateHighlighted];
    [composeBtn setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];

    [composeBtn setBackgroundImage:[UIImage imageNamed:[backImageName stringByAppendingString:@"_highlighted"]] forState:UIControlStateHighlighted];
    [composeBtn setBackgroundImage:[UIImage imageNamed:backImageName] forState:UIControlStateNormal];
    [composeBtn sizeToFit];
    return composeBtn;
}

@end
